<!--{template lyear:header_simple_start}-->
<script src="admin/scripts/admin.js?{VERHASH}"></script>
<!--{template lyear:header_simple_end}-->
<main class="bs-main-container">
	<div class="container-fluid">
		<!--{if $_GET['edit'] || $_GET['run']}-->
		<div class="card">
			<div class="card-body">
				<ul class="nav nav-pills">
					<li class="nav-item">
						<a hidefocus="true" class="nav-link <!--{if empty($_GET[ 'edit']) && empty($_GET[ 'run'])}-->active<!--{/if}-->" href="{MOD_URL}&op=cron">{lang cron}</a>
					</li>
					<!--{if !empty($_GET['edit'])}-->
					<li class="nav-item">
						<a hidefocus="true" class="nav-link active" href="{MOD_URL}&op=cron&edit=$_GET[edit]">{lang misc_cron_edit}</a>
					</li>
					<!--{/if}-->
					<!--{if !empty($_GET['run'])}-->
					<li class="nav-item">
						<a hidefocus="true" class="nav-link active" href="{MOD_URL}&op=cron&run=$_GET[run]">{lang misc_cron_operation}</a>
					</li>
					<!--{/if}-->
				</ul>
			</div>
		</div>
		<!--{/if}-->
		<div class="card">
			<div class="card-body">
				<!--{if $msg}-->
				<div class="alert alert-{$msg_type}" role="alert">
					$msg
				</div>
				<!--{if $redirecturl}-->
				<dl class="mb-3 d-grid">
					<a href="{$redirecturl}" class="btn btn-primary">{lang message_redirect}</a>
				</dl>
				<script type="text/JavaScript">setTimeout(function(){location.href='{$redirecturl}';}, 2000);</script>
				<!--{/if}-->
				<!--{else}-->
				<!--{if $_GET['edit']>0}-->
				<div class="alert alert-warning">
					<h5>{lang board_message}</h5>
					<ul class="form-text">
						{lang misc_cron_edit_tips}
					</ul>
				</div>
				<form id="cpform" action="{MOD_URL}&op=cron&edit=$cronid" class="form-horizontal" method="post" name="cpform">
					<input type="hidden" value="{FORMHASH}" name="formhash">
					<input type="hidden" value="true" name="editsubmit">
					<div class="row mb-3">
						<label  class="col-sm-2">{lang weekly}</label>
						<div class="col-sm-10">
							<select name="weekdaynew" class="form-control">
								<option value="-1" selected="selected">*</option>
								$weekdayselect
							</select>
							<span class="form-text">{lang misc_cron_edit_weekday_comment}</span>
						</div>
					</div>
					<div class="row mb-3">
						<label  class="col-sm-2">{lang everyday}</label>
						<div class="col-sm-10">
							<select name="daynew" class="form-control">
								<option value="-1" selected="selected">*</option>
								$dayselect
							</select>
							<span class="form-text">{lang misc_cron_edit_day_comment}</span>
						</div>
					</div>
					<div class="row mb-3">
						<label  class="col-sm-2">{lang hour}</label>
						<div class="col-sm-10">
							<select name="hournew" class="form-control">
								<option value="-1" selected="selected">*</option>
								$hourselect
							</select>
							<span class="form-text">{lang misc_cron_edit_hour_comment}</span>
						</div>
					</div>
					<div class="row mb-3">
						<label  class="col-sm-2">{lang minute}</label>
						<div class="col-sm-10">
							<input name="minutenew" value="{eval echo implode(',',$cron['minute'])}" type="text" class="form-control">
							<span class="form-text">{lang misc_cron_edit_minute_comment}</span>
						</div>
					</div>
					<div class="row mb-3">
						<label  class="col-sm-2">{lang misc_cron_edit_filename}</label>
						<div class="col-sm-10">
							<input name="filenamenew" value="$cron[filename]" type="text" class="form-control">
							<span class="form-text">{lang misc_cron_edit_filename_comment}</span>
						</div>

					</div>
					<dl class="mb-3 d-grid">
						<button type="submit" class="btn btn-primary btn-round bodyloading" name="exportsubmit" value="true">{lang blank_submit}</button>
					</dl>
				</form>
				<!--{elseif $_GET['run']}-->
				<!--{else}-->
				<div class="alert alert-warning">
					<h5>{lang board_message}</h5>
					<ul class="form-text">
						{lang misc_cron_tips}
						<li class="text-danger">计划任务默认通过用户访问触发。缺点是影响用户访问体验；计划任务执行不及时。可以修改config.php文件，设置参数 {eval echo '$_config[\'remote\'][\'on\']=1; $_config[\'remote\'][\'cron\']=1;';} 停止这种触发方式。</li>
						<li class="text-danger">建议通过系统计划任务来触发计划任务的执行，具体操作方式为定时访问指定域名下的 cron.php 文件。例如，可配置系统计划任务，使其定期访问 http://127.0.0.1/cron.php 地址，以此实现计划任务的自动触发。</li>
					</ul>
				</div>
				<form id="cpform" action="{MOD_URL}&op=cron" class="form-horizontal" method="post" name="cpform">
					<input type="hidden" value="{FORMHASH}" name="formhash">
					<input type="hidden" value="true" name="cronssubmit">
					<div class="table-responsive">
						<table class="table table-hover align-middle">
							<thead>
								<th width="45"></th>
								<th>{lang name}</th>
								<th>{lang available}</th>
								<th>{lang type}</th>
								<th>{lang time}</th>
								<th style="min-width: 120px">{lang misc_cron_last_run}</th>
								<th style="min-width: 120px">{lang misc_cron_next_run}</th>
								<th style="min-width: 140px">{lang operation}</th>
							</thead>
							<!--{loop $crons $cron}-->
							<tr>
								<td align="right"><input type="checkbox" class="form-check-input" name="delete[]" value="$cron[cronid]" <!--{if $cron[type]=='system' }-->disabled
									<!--{/if}-->></td>
								<td>
									<input type="text" name="namenew[{$cron[cronid]}]" class="form-control" value="$cron[name]">
									<strong>$cron[filename]</strong>
								</td>
								<td><label class="checkbox-inline"><input  type="checkbox" class="form-check-input" name="availablenew[{$cron[cronid]}]" value="1" <!--{if $cron[available]>0}-->checked="checked"<!--{/if}-->></label></td>
								<td>
									<!--{if $cron['type'] == 'system'}-->
									{lang inbuilt}
									<!--{elseif $cron['type'] == 'user'}-->
									{lang custom}
									<!--{/if}-->
								</td>
								<td>$cron[time]</td>
								<td>$cron[lastrun]</td>
								<td>$cron[nextrun]</td>

								<td>
									<a class="btn btn-outline-primary" href="{MOD_URL}&op=cron&edit=$cron[cronid]">{lang edit}</a>
									<!--{if $cron['run']}-->
									<a class="btn btn-outline-success" href="{MOD_URL}&op=cron&run=$cron[cronid]">{lang execute}</a>
									<!--{else}-->
									<a class="btn btn-outline-success disabled" href="javascript:;" class="text-muted" role="button" aria-disabled="true">{lang execute}</a>
									<!--{/if}-->
								</td>
							</tr>

							<!--{/loop}-->
							<tr>
								<td>{lang add_new}</td>
								<td colspan="10"><input type="text" name="newname" value="" class="form-control"></td>
							</tr>
						</table>
					</div>
					<div class="col-12">
						<div class="form-check">
							<input class="form-check-input" type="checkbox" name="chkall" id="chkallspKI"  onclick="checkAll('prefix', this.form, 'delete')">
							<label class="form-check-label" for="chkallspKI">{lang del}</label>
						</div>
					</div>
					<dl class="mb-3 d-grid">
						<button type="submit" class="btn btn-primary btn-round bodyloading" name="exportsubmit" value="true">{lang blank_submit}</button>
					</dl>
				</form>
				<!--{/if}-->
				<!--{/if}-->
			</div>
		</div>
	</div>
</main>
<!--{template lyear:footer_simple}-->